#include "../include/cat-internal.hpp"
#include "../include/cat-module.hpp"
#include "../include/cat-def.hpp"

#include "../include/util/platform.hpp"
#include "../include/util/cmem.hpp"


void free_module(cat_module* mod)
{
	if (!mod)
		return;

	if (mod->module) {

		if (mod->loaded && mod->unload)
			mod->unload();
	}
	//cat_dlclose(mod->module);

	bfree(mod->mod_name);
	bfree(mod->bin_path);
	bfree(mod->data_path);
	bfree(mod);
}



